//
//  UserService.m
//  MVP4
//
//  Created by 李煜 on 2024/6/21.
//

#import "UserService.h"
#import "User.h"

@implementation UserService

- (void)getUsers:(void(^)(NSArray<User *> *users))handler {
    User *user1 = [User userWithFirstName:@"First1" lastName:@"Last1" email:@"Iyad@test.com" age:36];
    User *user2 = [User userWithFirstName:@"First2" lastName:@"Last2" email:@"Mila@test.com" age:24];
    
    // 模拟网络请求耗时
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        handler(@[user1, user2]);
    });
}

@end

